﻿Public Class BlockFiveHomeworkSectionTwo
    Dim QuestionNumber As Integer
    Dim dtmTest, dtmTest2 As Date
    Dim filename As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    'Declare the Array as 10 rows and 3 columns
    Dim ArrayMax As Integer = 33 'One number past the end of actual info in array
    Dim HWQuestions(ArrayMax, 7) As String
    Dim intResponse As Integer
    Dim intQuestionCount As Integer = 0
    Dim intAnswerCount As Integer = 0
    Dim intReferenceCount As Integer = 0
    Dim intFirstRun As Integer = 1
    Dim strUser As String = "Enter Last Name"
    Dim strAnswer, strAnswer2, strAnswer3, strAnswer4, strAnswer5, _
     strAnswer6, strAnswer7, strAnswer8, strAnswer9, strAnswer10, strAnswer11, _
     strAnswer12, strAnswer13, strAnswer14, strAnswer15, strAnswer16, _
     strAnswer17, strAnswer18, strAnswer19, strAnswer20, strAnswer21, _
     strAnswer22, strAnswer23, strAnswer24, strAnswer25, strAnswer26, _
     strAnswer27, strAnswer28, strAnswer29, strAnswer30, strAnswer31, strAnswer32 As String
    Dim intChoiceACount As Integer = 2
    Dim intChoiceBCount As Integer = 3
    Dim intChoiceCCount As Integer = 4
    Dim intChoiceDCount As Integer = 5

    Shared Property MidiParent As MainForm

    Private Sub CloseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub BlockTwoHomeworkSectionOne_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        txtObj.Text = "Objectives:" + vbCrLf + "- Given proper student instructional materials, identify the operating principles of the ETVS."
        If (System.IO.File.Exists(filename & "\Homework\Block 5\Block 5 Section 2.txt")) Then
            intResponse = MsgBox("This assignment has already been completed.  Are you sure you want to delete the current assignment and reaccomplish it?", 4, "Confirm Assignment Deletion")
            If intResponse = MsgBoxResult.Yes Then
                System.IO.File.Delete(filename & "\Homework\Block 5\Block 5 Section 2.txt")
                System.IO.File.Create(filename & "\Homework\Block 5\Block 5 Section 2.txt").Dispose()
            ElseIf intResponse = MsgBoxResult.No Then
                Me.Close()
            End If
        End If
        If (Not System.IO.File.Exists(filename & "\Homework\Block 5\Block 5 Section 2.txt")) Then
            System.IO.File.Create(filename & "\Homework\Block 5\Block 5 Section 2.txt").Dispose()
        End If
        If (Not System.IO.File.Exists(filename & "\Instructor\Block 5\Block 5 Section 2.txt")) Then
            System.IO.File.Create(filename & "\Instructor\Block 5\Block 5 Section 2.txt").Dispose()
        End If
        strUser = InputBox("Please enter last name", strUser)
        If strUser Is "" Then
            Me.Close()
        End If
        '************************************************
        '****** Questions Are Loaded Here****************
        '******* Column 1 is Questions (Preloaded)*******
        '******* Column 2 is Accepts Students Answer*****
        '******* Column 3 is Reference ******************

        HWQuestions(1, 1) =  “1. TI 6650.53A, Section ______, provides descriptive data for the DENRO Enhanced Terminal Voice Switch.”
        HWQuestions(1, 2) = strAnswer
        HWQuestions(1, 3) = "Reference"

        HWQuestions(2, 1) = "2. DENRO supplies ______ basic rack configurations identified as basic systems (BS) ______ through ______."
        HWQuestions(2, 2) = strAnswer2
        HWQuestions(2, 3) = "Reference"

        HWQuestions(3, 1) = "3. The ETVS is a non-blocking, fully-integrated, ______________ voice communications system."
        HWQuestions(3, 2) = strAnswer3
        HWQuestions(3, 3) = "Reference"

        HWQuestions(4, 1) = "4. System design allows operators to communicate using __________, __________, and __________ voice paths."
        HWQuestions(4, 2) = strAnswer4
        HWQuestions(4, 3) = "Reference"

        HWQuestions(5, 1) = "5. Each voice processor manages access to a maximum of ______ audio channels on a Time Division Multiplexed (TDM) voice data bus network."
        HWQuestions(5, 2) = strAnswer5
        HWQuestions(5, 3) = "Reference"

        HWQuestions(6, 1) = "6. A redundant Carrier Sense Multiple Access with Collision Detection ____________________ bus interconnects all processors."
        HWQuestions(6, 2) = strAnswer6
        HWQuestions(6, 3) = "Reference"

        HWQuestions(7, 1) = "7. The ______________ contains the signal processing/distribution equipment to switch the radio and telephone circuits connected to the system."
        HWQuestions(7, 2) = strAnswer7
        HWQuestions(7, 3) = "Reference"

        HWQuestions(8, 1) = "8. The racks also contain the system __________ supplies and reserve power ______________."
        HWQuestions(8, 2) = strAnswer8
        HWQuestions(8, 3) = "Reference"

        HWQuestions(9, 1) = "9. The ______________ and ______________ equipment includes SCTs, Gateway/SCT, printers and uninterruptible power supplies."
        HWQuestions(9, 2) = strAnswer9
        HWQuestions(9, 3) = "Reference"

        HWQuestions(10, 1) = "10. The SCTs, Gateway/SCT and Remote SCT are computers running MS Windows ______ Professional."
        HWQuestions(10, 2) = strAnswer10
        HWQuestions(10, 3) = "Reference"

        HWQuestions(11, 1) = "11. The SCTs, Gateway/SCT and remote SCT sit on a 10/100 Base-T ______________ LAN."
        HWQuestions(11, 2) = strAnswer11
        HWQuestions(11, 3) = "Reference"

        HWQuestions(12, 1) = "12. The local SCTs connect to the central rack via the ______________, ____________, and the High Speed Serial Interface."
        HWQuestions(12, 2) = strAnswer12
        HWQuestions(12, 3) = "Reference"

        HWQuestions(13, 1) = "13. TED stands for ____________________."
        HWQuestions(13, 2) = strAnswer13
        HWQuestions(13, 3) = "Reference"

        HWQuestions(14, 1) = "14. The position connects to the central rack using a four-wire __________ telephone line."
        HWQuestions(14, 2) = strAnswer14
        HWQuestions(14, 3) = "Reference"

        HWQuestions(15, 1) = "15. RPIUs connect the remote positions with the central rack by converting four-wire __________ to two-wire __________."
        HWQuestions(15, 2) = strAnswer15
        HWQuestions(15, 3) = "Reference"

        HWQuestions(16, 1) = "16. A four-wire ISDN circuit is limited to __________ feet and a two-wire ISDN circuit is limited to __________ feet."
        HWQuestions(16, 2) = strAnswer16
        HWQuestions(16, 3) = "Reference"

        HWQuestions(17, 1) = "17. The electronics module that supports a TED position is either a __________ or a __________ module."
        HWQuestions(17, 2) = strAnswer17
        HWQuestions(17, 3) = "Reference"

        HWQuestions(18, 1) = "18. The ______________ position has a speaker panel to which audio signals may be patched for monitoring purposes."
        HWQuestions(18, 2) = strAnswer18
        HWQuestions(18, 3) = "Reference"

        HWQuestions(19, 1) = "19. The ______________ position has a complete operator position, supervisory record equipment, and a Remote Alarm Panel."
        HWQuestions(19, 2) = strAnswer19
        HWQuestions(19, 3) = "Reference"

        HWQuestions(20, 1) = "20. Radio, telephone, and legal record circuits terminate at ______________ from which they are connected to the central rack equipment."
        HWQuestions(20, 2) = strAnswer20
        HWQuestions(20, 3) = "Reference"

        HWQuestions(21, 1) = "21. Operator and radio lines connect to the central rack equipment at ______________ panels."
        HWQuestions(21, 2) = strAnswer21
        HWQuestions(21, 3) = "Reference"

        HWQuestions(22, 1) = "22. Telephone conferencers process up to ______ telephone lines."
        HWQuestions(22, 2) = strAnswer22
        HWQuestions(22, 3) = "Reference"

        HWQuestions(23, 1) = "23. Microphone audio from the position is converted into a __________ form for transmission to the central rack."
        HWQuestions(23, 2) = strAnswer23
        HWQuestions(23, 3) = "Reference"

        HWQuestions(24, 1) = "24. The operator processor processes the microphone audio and the __________ places it in the appropriate channel on the voice data bus."
        HWQuestions(24, 2) = strAnswer24
        HWQuestions(24, 3) = "Reference"

        HWQuestions(25, 1) = "25. The radio processor digitizes the receive signal and places it into time slots on the ______________ to the TMU."
        HWQuestions(25, 2) = strAnswer25
        HWQuestions(25, 3) = "Reference"

        HWQuestions(26, 1) = "26. The CCMS constantly monitors the status of the system, sounding an ________ should a failure be noted."
        HWQuestions(26, 2) = strAnswer26
        HWQuestions(26, 3) = "Reference"

        HWQuestions(27, 1) = "27. The __________ can be located local to the central rack or remotely via remote router, and modems."
        HWQuestions(27, 2) = strAnswer27
        HWQuestions(27, 3) = "Reference"

        HWQuestions(28, 1) = "28. The Gateway/SCT computer contains the system operating ______________ and current configuration __________."
        HWQuestions(28, 2) = strAnswer28
        HWQuestions(28, 3) = "Reference"

        HWQuestions(29, 1) = "1. TI 6650.53A, Section ______, contains general, generic information on the installation and checkout of the ETVS system."
        HWQuestions(29, 2) = strAnswer29
        HWQuestions(29, 3) = "Reference"

        HWQuestions(30, 1) = "2. The ETVS will be installed in two types of environments:"
        HWQuestions(30, 2) = strAnswer30
        HWQuestions(30, 3) = "Reference"

        HWQuestions(31, 1) = "3. The ______________ is used for the control of airfield traffic as well as vehicles traveling on the flight line."
        HWQuestions(31, 2) = strAnswer31
        HWQuestions(31, 3) = "Reference"

        HWQuestions(32, 1) = "4. Radar Approach Control is used for control of aircraft on ______________ or ______________ within radar range of the airport."
        HWQuestions(32, 2) = strAnswer32
        HWQuestions(32, 3) = "Reference"

        HWQuestions(33, 1) = "Close"

        Next_Question(HWQuestions)
    End Sub

    Private Sub btnNextQuestion_Click(sender As System.Object, e As System.EventArgs) Handles btnNextQuestion.Click
        Next_Question(HWQuestions)
    End Sub
    Private Sub Clear_Display()
        txtQuestion.Clear()
        txtAnswer.Clear()
    End Sub

    Public Function Next_Question(HWQuestions As String(,))
        txtAnswer.Focus()
        If intQuestionCount > 0 Then
            WriteToFile()
        End If
        If btnNextQuestion.Text = "Done" Then
            Me.Close()
            OpenResults()
        End If
        intQuestionCount = intQuestionCount + 1
        LabelChangeCheck()
        If intQuestionCount = 32 Then
            btnNextQuestion.Text = "Done"
        End If
        txtQuestion.Text = HWQuestions(intQuestionCount, 1)
        intAnswerCount = intAnswerCount + 1
        HWQuestions(intAnswerCount, 2) = txtAnswer.Text
        intReferenceCount = intReferenceCount + 1
        txtReference.Text = HWQuestions(intReferenceCount, 3)

        Return intQuestionCount & intAnswerCount
    End Function

    Private Sub LabelChangeCheck()
        If intQuestionCount = 1 Then
            lblSubject.Text = "System Description"
        ElseIf intQuestionCount = 29 Then
            lblSubject.Text = "Installation"
        End If
    End Sub

    Private Sub WriteToFile()
        Dim Integrity As String = (filename & "\Instructor\Block 5\Block 5 Section 2.txt")
        Dim Results As String = (filename & "\Homework\Block 5\Block 5 Section 2.txt")

        '***********Output to hidden file for Instructor Check***********
        If System.IO.File.Exists(Integrity) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Integrity, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine("- " & txtObj.Text)
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            hiddenWriter.WriteLine("Answer:" & txtAnswer.Text)
            hiddenWriter.WriteLine("Reference: " & txtReference.Text)
            hiddenWriter.WriteLine()
            If intQuestionCount = 32 Then
                hiddenWriter.WriteLine("Block 5 Section 2 Homework Complete")
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Integrity")
        End If

        '******Output to file for Student to review***********
        If System.IO.File.Exists(Results) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Results, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                'hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                'hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine(lblSubject.Text)
            ElseIf intQuestionCount = 29 Then
                hiddenWriter.WriteLine(lblSubject.Text)
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            hiddenWriter.WriteLine("Answer:" & txtAnswer.Text)
            'hiddenWriter.WriteLine("Reference: " & txtReference.Text)
            hiddenWriter.WriteLine()
            If intQuestionCount = 32 Then
                hiddenWriter.WriteLine("Block 5 Section 2 Homework Complete")
                'hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                'hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Results")
        End If

        If intQuestionCount > 0 Then
            txtAnswer.Clear()
        End If

    End Sub

    Private Sub OpenResults()
        Dim p As Process = Process.Start(filename & "\Homework\Block 5\Block 5 Section 2.txt")
    End Sub
End Class
